]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Simplify key width handling
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 26 Jan 2024 11:02:30 +0000 (12:02 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 29 Feb 2024 15:34:21 +0000 (16:34 +0100)
We do not need to store the key width in the Key object
itself when constructing the layout, and can attach it
to the grid from the model data right away.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3162>

js/ui/keyboard.js

index 38f1b8ee3a3dcdfc412cc50fdc13a5b6625d7640..fb83db7e962afe182c127b09a16453ae7bdd5577 100644 (file)
@@ -437,7 +437,6 @@ const Key = GObject.registerClass({
             button.set_label(commitString);
         }
 
-        button.keyWidth = 1;
         button.connect('button-press-event', () => {
             this._press(button, commitString);
             button.add_style_pseudo_class('active');
@@ -505,10 +504,6 @@ const Key = GObject.registerClass({
         return this._boxPointer;
     }
 
-    setWidth(width) {
-        this.keyButton.keyWidth = width;
-    }
-
     setLatched(latched) {
         if (latched)
             this.keyButton.add_style_pseudo_class('latched');
@@ -1528,9 +1523,6 @@ export const Keyboard = GObject.registerClass({
                 keyval: key.keyval,
             }, strings);
 
-            if (key.width !== null)
-                button.setWidth(key.width);
-
             if (key.action !== 'modifier') {
                 button.connect('commit', (_actor, keyval, str) => {
                     this._commitAction(keyval, str).then(() => {
@@ -1590,7 +1582,7 @@ export const Keyboard = GObject.registerClass({
             if (key.action || key.keyval)
                 button.keyButton.add_style_class_name('default-key');
 
-            layout.appendKey(button, button.keyButton.keyWidth);
+            layout.appendKey(button, key.width);
         }
     }